package com.example.config.Utility;


import lombok.Data;


/**
 * 统一回复工具类
 */


@Data
public class Result<T> {

    private Integer code;

    private String message;

    private T date;

    //调用成功函数


    public static <T> Result<T> succeed(T object) {
        Result r = new Result();
        r.date = object;
        r.code = 200;
        return r;
    }


    //调用失败函数
    public static <T> Result<T> fail(T object) {
        Result r = new Result();
        r.code = 400;
        r.message = "失败";
        return r;
    }
}
